package com.imooc.task;

import com.imooc.service.BookService;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 完成自动计算任务
 */
@Component
@Lazy(value = false)
public class ComputeTask {
    @Resource
    private BookService bookService;

    @Scheduled(cron = "1 * * * * ?")
    public void updateEvaluation() {
        System.out.println("开始执行定时任务");
        bookService.updateEvaluation();
    }
}
